package com.zhou.push;

import android.os.RemoteException;
import android.util.Log;

import java.io.*;

/**
 * Created by zhou on 2016/3/14 0014.
 */
public class IMReader extends Thread{

    private InputStream mInputStream;
    private ICallBack mCb;
    public IMReader(InputStream inputStream,ICallBack cb){
        this.mInputStream = inputStream;
        this.mCb = cb;
    }
    @Override
    public void run() {
        super.run();
        while(true){
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(mInputStream));
                String msg = bufferedReader.readLine();
                Log.i("----->", "this is read msg=" + msg);
                mCb.read(msg);
            } catch (IOException e) {
                e.printStackTrace();
                break;
            } catch (RemoteException e) {
                e.printStackTrace();
                System.out.println("mCb.read(msg);出问题了");
            }

        }

    }
}
